﻿using System;
using System.Runtime.InteropServices;
using PinLib;


namespace pinlib.structs
{
    [StructLayout(LayoutKind.Sequential)]
    internal struct MOUSEINPUT
    {
        public int dx;
        public int dy;
        public int mouseData;
        public int dwFlags;
        public int time;
        public IntPtr dwExtraInfo;
    };

    [StructLayout(LayoutKind.Sequential)]
    internal struct KEYBDINPUT
    {
        public short wVk;
        public short wScan;
        public int dwFlags;
        public int time;
        public IntPtr dwExtraInfo;
    };

    [StructLayout(LayoutKind.Sequential)]
    internal struct HARDWAREINPUT
    {
        public int uMsg;
        public short wParamL;
        public short wParamH;
    }

    [StructLayout(LayoutKind.Explicit)]
    internal struct UNION
    {
        [FieldOffset(0)]
        public MOUSEINPUT mouseInput;
        [FieldOffset(1)]
        public KEYBDINPUT keyboardInput;
        [FieldOffset(2)]
        public HARDWAREINPUT hardwareInput;
    };

    [StructLayout(LayoutKind.Sequential)]
    internal struct INPUT
    {
        public int type;
        public UNION union;
    };

    [StructLayout(LayoutKind.Sequential)]
    internal struct WINDOWINFO
    {
        /// <summary>
        ///   The size of the structure, in bytes. The caller must set this member to sizeof(WINDOWINFO)
        /// </summary>
        internal int cbSize;

        /// <summary>
        ///   The coordinates of the window
        /// </summary>
        internal GDIStructures.RECT rcWindow;

        /// <summary>
        ///   The coordinates of the client area
        /// </summary>
        internal GDIStructures.RECT rcClient;

        /// <summary>
        ///   The window styles. For a table of window styles, see Window Styles
        /// </summary>
        internal int dwStyle;

        /// <summary>
        ///   The extended window styles. For a table of extended window styles, see Extended Window Styles.
        /// </summary>
        internal int dwExStyle;

        /// <summary>
        ///   The window status. If this member is WS_ACTIVECAPTION (0x0001),
        ///   the window is active. Otherwise, this member is zero.
        /// </summary>
        internal int dwWindowStatus;

        /// <summary>
        ///   The width of the window border, in pixels
        /// </summary>
        internal uint cxWindowBorders;

        /// <summary>
        ///   The height of the window border, in pixels.
        /// </summary>
        internal uint cyWindowBorders;

        /// <summary>
        ///   The window class atom
        /// </summary>
        internal int atomWindowType;

        /// <summary>
        ///   The Windows version of the application that created the window
        /// </summary>
        internal int wCreatorVersion;
    }

    /// <summary>
    ///   Contains extended result information obtained by calling the ChangeWindowMessageFilterEx function
    /// </summary>
    /// <seealso>http://msdn.microsoft.com/en-us/library/dd388197(VS.85).aspx</seealso>
    public struct CHANGEFILTERSTRUCT
    {
        /// <summary>
        /// If the function succeeds, this field contains one of the values in the ExtStatus enum
        /// </summary>
        public int ExtStatus;

        /// <summary>
        ///   The size of the structure, in bytes. Must be set to sizeof(CHANGEFILTERSTRUCT)
        /// </summary>
        public uint CbSize;
    }

    /// <summary>
    /// The PAINTSTRUCT structure contains information for an application. This information can be used to paint the client area of a window owned by that application
    /// </summary>
    public struct PAINTSTRUCT
    {
        /// <summary>
        /// A handle to the display DC to be used for painting
        /// </summary>
        IntPtr hdc;
        /// <summary>
        /// Indicates whether the background must be erased. This value is nonzero if the application should erase the background
        /// </summary>
        bool fErase;
        /// <summary>
        /// A RECT structure that specifies the upper left and lower right corners of the rectangle in which the painting is requested, in device units relative to the upper-left corner of the client area
        /// </summary>
       GDIStructures.RECT rcPaint;
        /// <summary>
        /// Reserved; used internally by the system
        /// </summary>
        bool fRestore;
        /// <summary>
        /// Reserved; used internally by the system
        /// </summary>
        bool fIncUpdate;
        /// <summary>
        /// Reserved; used internally by the system
        /// </summary>
        byte[] rgbReserved;

        public PAINTSTRUCT(byte[] rgbReserved) : this()
        {
            this.rgbReserved = rgbReserved;
        }
    }


}